<?php

    function smarty_function_upload($params, &$smarty)
	{
		define("MULTIPART_FORM", true);

		$id = $params["id"]; // required. id value all time page or view class member value name.
		if (isset($_POST["Control:$id"]) && isset($smarty->Controls[$id]) == false)
		{
			$smarty->Controls[$id] = $_POST["Control:$id"];
		}
		$text = (isset($smarty->Controls[$id])) ? $smarty->Controls[$id] : $params["text"]; // required
		echo "<input id=\"$id\" name=\"Control:$id\" type=\"file\" value=\"$text\"/>";


		$smarty->Trace->Add("$id control loading...");
	}

?>
